﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="Phoenix.Service.Model" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Index
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<form id="form1" runat="server">
<div class="path">
        <strong>权限管理</strong>
    </div>
    <div class="pd10">
        <div class="mb10 aL">
            <a href="javascript:void(showAdd())" title="添加类别" class="a-btn1" >添加类别</a>
        </div>
          <span id="Grid">
<table class="tb-list hover">
    <tr>
        <th>
            权限ID
        </th>
        <th>
            权限名称
        </th>
         <th >
           创建时间
        </th>
         <th >
            更新时间
        </th>
         <th  style=" width:20%">
            操作
        </th>
    </tr>
    <%  IList<RightsTypeModel> RightsTypeList = ViewData["RightsTypeList"] as List<RightsTypeModel>; %>
    <%foreach (var item in RightsTypeList) %> 
    <%{ %>
     <tr>
        <td >
           <%=item.TypeID %>
        </td>
         <td >
           <%=item.TypeName %>
        </td>         
        <td >
           <%=item.CreateTime.ToString() %>
        </td>
         <td >
           <%=item.UpdateTime.ToString()%>
        </td>
        <td style="width:20%">
           <a href="javascript:void(showEdit('<%=item.TypeID %>'))">编辑</a>  <a href="/Rights/index?TypeID=<%=item.TypeID %>">功能权限</a> <a href="javascript:;" onclick="DeleteType('<%=item.TypeID %>')">删除</a>
        </td>
    </tr>
    <%} %>
</table>
        </span>
    </div>
    </form>
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="HeadScripts" runat="server">
        <script type="text/javascript" src="/Scripts/m-lhgdialog/m-lhgdialog.js"></script>    
	<script type="text/javascript" src="/Scripts/library/m-pagination.js"></script>    

</asp:Content>

<asp:Content ID="Content5" ContentPlaceHolderID="BodyScripts" runat="server">
    <script type="text/javascript">

        // 删除类目
        function DeleteType(typeID) {
            if (confirm("确认删除吗?") == false) {
                return;
            }

            $.ajax({
                url: "/RightsType/Delete",
                data: { "typeID": typeID },
                type: "POST",
                success: function (data, textStatus) {
                    if (data.status === "warning" || data.status === "error") {
                        alert(data.msg);
                        return false;
                    }
                    // 刷新列表
                    refresh();
                },
                error: function (XmlHttpRequest, textStatus, errorThrown) {
                    alert(errorThrown);
                }
            });
        };

        // 显示编辑
        function showEdit(typeid) {
            OpenPop('/RightsType/edit?typeid=' + typeid, "编辑权限类目", 500, 250);
        };
        // 显示编辑
        function showAdd() {
            OpenPop('/RightsType/edit', "添加权限类目", 500, 250);
        };

        //打开弹窗
        function OpenPop(url, titleName, width, height) {
            width = width || 800;
            height = height || 500;
            window.top.winObj = window;
            window.top.oDG = new $.dialog({ id: 'esDialog', title: titleName, page: url, width: width, height: height, btnBar: false, lockScroll: true });
            window.top.oDG.ShowDialog();
        }
        
</script> 
</asp:Content>